//
//  NoDataView.h
//  weizhuan
//
//  Created by lixun on 13-8-1.
//  Copyright (c) 2013年 lixun. All rights reserved.
//

#import "NoDataView.h"
#import "AppUtility.h"

@implementation NoDataView
@synthesize delegate =_delegate;

- (void)viewTapped:(UITapGestureRecognizer*)gesture_ {
    if (self.delegate!=nil && [(NSObject*)self.delegate respondsToSelector:@selector(viewTapped)]) {
        [self.delegate viewTapped];
    }
}

- (id)initWithFrame:(CGRect)frame text:(NSString*)text{
    
    self = [super initWithFrame:frame];
    if (self) {
        // Initialization code.
		self.backgroundColor = [AppUtility getViewBGColor];
		/*UIImage *image = [AppUtility getLocalImage:@"tanhao_1"];
		UIImageView *v = [[UIImageView alloc] initWithFrame:CGRectMake((320-image.size.width)/2, 100, image.size.width, image.size.height)];
		v.image = image;
		[self addSubview:v];
		[v release];
		{
            UILabel *label = [[UILabel alloc] initWithFrame:CGRectMake(0, frame.size.height/2-10, 320, 22)];
            label.backgroundColor = [UIColor clearColor];
            label.font = [UIFont systemFontOfSize:22];
            label.textColor =[UIColor grayColor];
            label.text = text;
            label.textAlignment = UITextAlignmentCenter;
            [self addSubview:label];
            [label release];
        }
        {
            UILabel *label = [[UILabel alloc] initWithFrame:CGRectMake(0, frame.size.height/2-10+30, 320, 12)];
            label.backgroundColor = [UIColor clearColor];
            label.font = [UIFont systemFontOfSize:12];
            label.textColor =[UIColor lightGrayColor];
            label.text = @"点击屏幕，重新加载";
            label.textAlignment = UITextAlignmentCenter;
            [self addSubview:label];
            [label release];
        }*/
        
        UILabel *label = [[UILabel alloc] initWithFrame:CGRectMake(0, frame.size.height/2-10, 320*theApp.autoSizeScaleX, 15*theApp.autoSizeScaleY)];
        label.backgroundColor = [UIColor clearColor];
        label.font = [UIFont systemFontOfSize:14];
        label.textColor =[UIColor lightGrayColor];
        label.text = text;
        label.textAlignment = NSTextAlignmentCenter;
        [self addSubview:label];
        [label release];

        self.userInteractionEnabled = YES;
        UITapGestureRecognizer *tap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(viewTapped:)];
        [self addGestureRecognizer:tap];
        [tap release];

    }
    return self;
}

- (void)dealloc {
    [super dealloc];
}


@end
